﻿using Microsoft.AspNetCore.Mvc;
using OrderService.Services;
using ProductService.Services.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;

namespace OrderService.Controllers;

[Route("api/orderservice/[action]")]
public class OrderController : AbpController, IOrderService
{
    public IOrderService orderService { get; set; }

    public OrderController()
    {

    }

    [HttpPost]
    public async Task<OrderDto> CreateAsync(OrderDto input)
    {
        return await orderService.CreateAsync(input);
    }

    [HttpDelete]
    public async Task DeleteAsync(Guid id)
    {
        await orderService.DeleteAsync(id);
    }

    [HttpGet]
    public async Task<OrderDto> GetAsync(Guid id)
    {
        return await orderService.GetAsync(id);
    }

    [HttpPost]
    public async Task<PagedResultDto<OrderDto>> GetListAsync(PagedAndSortedResultRequestDto input)
    {
        return await orderService.GetListAsync(input);
    }

    [HttpPut]
    public async Task<OrderDto> UpdateAsync(Guid id, OrderDto input)
    {
        return await orderService.UpdateAsync(id, input);
    }
}
